﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using NakedObjects;
using NakedObjects.Services;


namespace HRMDomain
{
    [DisplayName("Locations")]
    public class LocationRepository : AbstractFactoryAndRepository
    {
        #region Injected Services
        // This region should contain properties to hold references to any services required by the
        // object.  Use the 'injs' shortcut to add a new service.

        #endregion

        
        public Location CreateNewLocation(string Name)
        {
            Location obj = Container.NewTransientInstance<Location>();
            obj.Name = Name;
            Container.Persist(ref obj);
            Container.InformUser("New Location Added.");
            return obj;
        }
         
        public IQueryable<Location> AllLocations()
        {
            return Container.Instances<Location>();
        }
      
        // 'find' for a method to find a single object by query
        // 'list' for a method to return a list of objects matching a query

    }
}
